import { getRequest, postRequest } from "./fetch/request";

const api = "http://qp-api-scrm.yunkaodian.com";

interface loginProps {
  username: string;
  password: string;
  cid: number;
}

// 账号密码登录
export const login = async (props: loginProps) => {
  return await postRequest({ url: `${api}/auth/user/login`, data: props });
};

export const token = async () => {
  return await getRequest({
    url: `${api}/import/customer/get_overview?current=1&limit=10`,
  });
};

// 根据授权信息登录
export const getAuth = async (auth_code: string) => {
  return await getRequest({
    url: `${api}/auth/wework/get_qr_login_info?auth_code=${auth_code}`,
  });
};

// 已注册企业微信
export const getToAuthorization = async () => {
  return await getRequest({
    url: `http://qp-base-scrm.yunkaodian.com/wework/install`,
  });
};

// 验证是否注册企业微信
export const checkRegister = async (auth_code: string) => {
  return await getRequest({
    url: `http://qp-base-scrm.yunkaodian.com/wework/get_auth?auth_code=${auth_code}`,
  });
};

// 未注册企业微信
